feat: use rspec retry to deflake ci#6285
Merged
elasticspoon merged 6 commits intomainfrom Mar 31, 2025
Merged
Conversation
This is a bandaid fix that does not address the root cause.
94c145b to
fb55e24
Compare
fb55e24 to
c2a68f5
Compare
2e7e930 to
cbab1ac
Compare
cbab1ac to
0445b8d
Compare
elasticspoon
commented
Mar 31, 2025
Comment on lines
+58
to
+61
| within ".ts-dropdown-content" do | ||
| expect(page).not_to have_css("input.form-check-input--unchecked") | ||
| expect(page).to have_css("input.form-check-input--checked", count: 3) | ||
| end |
Collaborator
Author
There was a problem hiding this comment.
This is an ugly fix but the issue with the initial code is that when you run checked? on the nodes rspec won't use any capybara waiting. It checks right at the moment and either passes or fails.
Thus, if the test runs that check before the javascript on the page runs the test will fail. When we use have_ selectors we can avoid this issue.
I would like to have done something more like `have_checked("id_of_input") but tomselect does not give us something like that. instead I added a css class for checked and unchecked inputs in tomselect and assert against that.
Collaborator
|
:) |
compwron
reviewed
Mar 31, 2025
| group :test do | ||
| gem "brakeman" # security inspection | ||
| gem "capybara" | ||
| gem "rspec-retry" # for retrying flaky tests |
Collaborator
There was a problem hiding this comment.
https://rubygems.org/gems/rspec-retry seems reasonable, last update 2019 but simple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
rspec-retryto compensate for some flakiness by retrying failures.The basic issue in common with the failures is a pattern like:
The issue is that the tests are often faster than the server, thus, the check it the action worked happens before the action finished. Ex:
Thus, we can use capybara waits to fix this. Basically we want to check that the front end shows the action finished (we see an alert) then check the database state.